package com.wk.springcloud.user.server.biz;

import com.wk.springcloud.user.feign.qo.UserQO;
import com.wk.springcloud.user.feign.vo.UserVO;
import com.wk.springcloud.user.server.dao.UserDao;
import com.wk.springcloud.user.server.dao.impl.mapper.entity.User;
import com.wk.springcloud.util.tool.BeanUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class FeignUserBiz {

	@Autowired
	private UserDao dao;

	public int save(UserQO qo) {
		User record = BeanUtil.copyProperties(qo, User.class);
		return dao.save(record);
	}

	public int deleteById(Long id) {
		return dao.deleteById(id);
	}

	public UserVO getById(Long id) {
		User record = dao.getById(id);
		return BeanUtil.copyProperties(record, UserVO.class);
	}

	public int updateById(UserQO qo) {
		User record = BeanUtil.copyProperties(qo, User.class);
		return dao.updateById(record);
	}

}
